#include "package.h"

Package::Package()
{
    pIpHead = NULL;
}
Package::Package(iphdr *ipptr){
    pIpHead = ipptr;
}
Package::~Package(){
    delete pIpHead;
}

int Package::GetLength(){
    return pIpHead->tot_len;
}

struct iphdr* Package::GetIpHead(){
    return pIpHead;
}

char* Package::GetDstAddr(){
    struct in_addr addr;
    addr.s_addr = pIpHead->daddr;
    return inet_ntoa(addr);
}

char* Package::GetSrcAddr(){
    struct in_addr addr;
    addr.s_addr = pIpHead->saddr;
    return inet_ntoa(addr);
}

void Package::SetIpHead(iphdr *ipptr){
    pIpHead = ipptr;
}
